package com.wxg.controller;

import com.wxg.common.core.dto.Address;
import com.wxg.common.feign.remote.DictRemote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @author void
 * @date 2019/6/26 10:27
 * @desc
 */
@RequestMapping("/temp")
@RestController
public class TempController {

    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private DictRemote dictRemote;

    @GetMapping("/cacheTest")
    public void cacheTest(){
        redisTemplate.opsForValue().set("testKey", "111", 1L, TimeUnit.MINUTES);
    }

    @GetMapping("/test")
    public Address test(){
        return dictRemote.validDefaultValue();
    }

    @GetMapping("/query1")
    public void query1(){
        dictRemote.query1("name");
    }
}
